#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<cstdlib>
#include<iomanip>
#include<algorithm>
typedef long long LL;
using namespace std;

int main() {

    int n;
    int i;
    char m[12];
    scanf("%d",&n);
    while(n--)
    {
        scanf("%s",m);
        printf("6%s\n",m+6);

    }
	return 0;
}